package com.ruoyi.web.controller.zhhq;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zhhq.domain.Meetingorder;
import com.ruoyi.zhhq.service.IMeetingorderService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会议订单Controller
 * 
 * @author ruoyi
 * @date 2022-10-27
 */
@RestController
@RequestMapping("/zhhq/meetingorder")
public class MeetingorderController extends BaseController
{
    @Autowired
    private IMeetingorderService meetingorderService;

    /**
     * 查询会议订单列表
     */
    @PreAuthorize("@ss.hasPermi('zhhq:meetingorder:list')")
    @GetMapping("/list")
    public TableDataInfo list(Meetingorder meetingorder)
    {
        startPage();
        List<Meetingorder> list = meetingorderService.selectMeetingorderList(meetingorder);
        return getDataTable(list);
    }

    /**
     * 导出会议订单列表
     */
    @PreAuthorize("@ss.hasPermi('zhhq:meetingorder:export')")
    @Log(title = "会议订单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Meetingorder meetingorder)
    {
        List<Meetingorder> list = meetingorderService.selectMeetingorderList(meetingorder);
        ExcelUtil<Meetingorder> util = new ExcelUtil<Meetingorder>(Meetingorder.class);
        util.exportExcel(response, list, "会议订单数据");
    }

    /**
     * 获取会议订单详细信息
     */
    @PreAuthorize("@ss.hasPermi('zhhq:meetingorder:query')")
    @GetMapping(value = "/{orderId}")
    public AjaxResult getInfo(@PathVariable("orderId") String orderId)
    {
        return AjaxResult.success(meetingorderService.selectMeetingorderByOrderId(orderId));
    }

    /**
     * 新增会议订单
     */
    @PreAuthorize("@ss.hasPermi('zhhq:meetingorder:add')")
    @Log(title = "会议订单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Meetingorder meetingorder)
    {
        return toAjax(meetingorderService.insertMeetingorder(meetingorder));
    }

    /**
     * 修改会议订单
     */
    @PreAuthorize("@ss.hasPermi('zhhq:meetingorder:edit')")
    @Log(title = "会议订单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Meetingorder meetingorder)
    {
        return toAjax(meetingorderService.updateMeetingorder(meetingorder));
    }

    /**
     * 删除会议订单
     */
    @PreAuthorize("@ss.hasPermi('zhhq:meetingorder:remove')")
    @Log(title = "会议订单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{orderIds}")
    public AjaxResult remove(@PathVariable String[] orderIds)
    {
        return toAjax(meetingorderService.deleteMeetingorderByOrderIds(orderIds));
    }
}
